package cn.broadsense.common.annotation;

import cn.broadsense.common.validator.ValueInEnumValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @author huangjinshi
 * @description
 * @createDate 2024-09-20 10:42:32
 */
@Constraint(validatedBy = ValueInEnumValidator.class)
@Target({ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
public @interface ValueInEnum {
    String message() default "Value is not in the list of allowed values";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    String[] allowedStringValues();

    int[] allowedIntValues() default {};
}
